(setq gnus-select-method '(nntp "news.cn99.com"))

;; (add-to-list 'gnus-secondary-select-methods
;; 	     '(nntp "news.gmane.org"
;; 		    (nntp-port-number 119)))

(setq user-full-name "zhili hu")
(setq user-mail-address "huzhili@gmail.com")
;; set mail reader
(setq gnus-secondary-select-moethods '((nnml "")))

;; set pop server
;; (setq mail-sources
;;       '((pop :server "pop3.gmail.com"   ;
;;              :user "huzhili@gmail.com"  ;
;;              :port "pop3"               ;
;;              :password "password")))    ;

;; set smtp

(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
      smtpmail-auth-credentials '(("smtp.gmail.com" 587 "huzhili@gmail.com" nil))
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      smtpmail-local-domain "yourcompany.com")

 (setq smtpmail-default-smtp-server "smtp.gmail.com") 
 (setq smtpmail-smtp-server "smtp.gmail.com") 
 (setq message-send-mail-function 'smtpmail-send-it) 

;;;  Eye candy:

(setq gnus-group-line-format "%M%m%S%p%P%5y:%B%(%g%)%O\n")
;; (setq gnus-group-line-format "%M%m%S%p%P%5y:%B%(%c%)%O\n"
;;       gnus-group-uncollapsed-levels 3)

(gnus-add-configuration
 '(article (vertical 1.0 (summary .30 point) (article 1.0))))

(setq gnus-face-9 'font-lock-warning-face)
(setq gnus-face-10 'shadow)

(defun sdl-gnus-summary-line-format-ascii nil
  (interactive)
  (setq gnus-summary-line-format
        (concat
         "%0{%U%R%z%}" "%10{|%}" "%1{%d%}" "%10{|%}"
	 "%(%-15,15f %)" "%10{|%}" "%4k" "%10{|%}"
         "%10{%B%}" "%s\n"))
         ;"%9{%u&@;%}" "%(%-15,15f %)" "%10{|%}" "%4k" "%10{|%}"
         ;"%2u&score;" "%10{|%}" "%10{%B%}" "%s\n"))
  (setq gnus-sum-thread-tree-single-indent   "o "
        gnus-sum-thread-tree-false-root      "x "
        gnus-sum-thread-tree-root            "* "
        gnus-sum-thread-tree-vertical        "| "
        gnus-sum-thread-tree-leaf-with-other "|-> "
        gnus-sum-thread-tree-single-leaf     "+-> " ;; "\\" is _one_ char
        gnus-sum-thread-tree-indent          "  ")
  (gnus-message 5 "Using ascii tree layout."))

(defun sdl-gnus-summary-line-format-unicode nil
  (interactive)
  (setq gnus-summary-line-format
        (concat
         "%0{%U%R%z%}" "%10{│%}" "%1{%d%}" "%10{│%}"
         "%(%-15,15f %)" "%10{│%}" "%4k"
         "%10{│ %}" "%10{%B%}" "%s\n"))
         ;"%9{%u&@;%}" "%(%-15,15f %)" "%10{│%}" "%4k" "%10{│%}"
         ;"%2u&score;" "%10{│%}" "%10{%B%}" "%s\n"))

  (setq gnus-sum-thread-tree-single-indent   "◎ "
        gnus-sum-thread-tree-false-root      "  "
        gnus-sum-thread-tree-root            "┌ "
        gnus-sum-thread-tree-vertical        "│"
        gnus-sum-thread-tree-leaf-with-other "├─>"
        gnus-sum-thread-tree-single-leaf     "└─>"
        gnus-sum-thread-tree-indent          "  ")
  (gnus-message 5 "Using ascii tree layout with unicode chars."))

;; (sdl-gnus-summary-line-format-ascii)
(sdl-gnus-summary-line-format-unicode)


;;; Groups & Topics:

(setq gnus-large-newsgroup 500
      gnus-activate-level 3
      gnus-topic-display-empty-topics t)

;; (setq gnus-read-active-file t           ; I need set to t for use with Dovecot
;;       gnus-check-new-newsgroups t       ; I need set to t for use with Dovecot
;;       gnus-auto-subscribed-groups "^[A-Z]" ; Matches INBOX, Sent, Thrash...
;;       gnus-subscribe-options-newsgroup-method 'gnus-subscribe-interactive)

(setq gnus-read-active-file 'some
      gnus-check-new-newsgroups 'ask-server
      ;; gnus-save-killed-list nil    ; nil only when `some' or `ask-server' above
      gnus-subscribe-newsgroup-method 'gnus-subscribe-interactive)

;; Sort first by name, then by rank (level + score). Note adding two
;; separate hooks does not work. Also, gnus-group-prepare-hook cannot
;; be used for this. Note that topic-mode should run first, therefore
;; added last.
(add-hook 'gnus-group-mode-hook 'gnus-group-sort-groups-by-rank)
(add-hook 'gnus-group-mode-hook 'gnus-group-sort-groups-by-alphabet)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)

;;;  Message/Article & Threads:

(setq gnus-visible-headers "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^[BGF]?Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Mail-Followup-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-From:\\|^X-Sent:\\|^User-Agent:\\|^X-Mailer:\\|^X-Newsreader:\\|^X-Spam-Level:")
(setq gnus-sorted-header-list '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:" "^Followup-To:" "^To:" "^Cc:" "^Date:" "^Organization:" "^User-Agent:" "^X-Mailer:" "^X-Newsreader:" "^X-Spam-Level:"))

(setq gnus-fetch-old-headers 50)

(setq mm-inline-text-html-with-images t
      mm-inline-large-images t
      mm-discouraged-alternatives '("text/html" "text/richtext"))
